fix: split multi-statement ClickHouse golang-migrate migrations#1420
fix: split multi-statement ClickHouse golang-migrate migrations#1420
Conversation
ClickHouse's golang-migrate driver does not support multi-statement queries. The migrations introduced in #1415 and #1416 contained multiple ALTER TABLE statements per file, which works fine with Atlas but fails with golang-migrate. Split the 3 multi-statement migrations into 9 single-statement files. Also re-timestamps out-of-order postgres migrations. Co-Authored-By: Claude Opus 4.5 <[email protected]>
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
|
||||||||||||||||
|
|
||||||||||||||||
Preview Environment (PR #1420)Preview environment scaled down after 12h of inactivity. |
There was a problem hiding this comment.
Why did these get renamed? I don't believe this should go in because it's completely unrelated with the clickhouse issue.
There was a problem hiding this comment.
this was a result of running clickhouse rebase i believe but might be wrong - the original issue i ran into was out of order migrations
There was a problem hiding this comment.
The problem is that these migrations are not clickhouse migrations - they're PG migrations, which was what stood out to me 🤔
Summary
Root cause
mise clickhouse:diffuses Atlas to generate both Atlas and golang-migrate migration files. Atlas natively supports multi-statement SQL, so the generated Atlas migrations work fine. However, the golang-migrate output uses the exact same SQL content, and golang-migrate's ClickHouse driver only supports one statement per migration file.This was never caught because:
golang-migrate exists specifically as an alternative for developers who don't have an Atlas Pro account (see
server/clickhouse/local/golang_migrate/README.md). Anyone using it would hit this error onmise clickhouse:migrate:Recovery
If you previously attempted these migrations with golang-migrate and hit a dirty state, run:
migrate -path server/clickhouse/local/golang_migrate -database "$GRAM_CLICKHOUSE_GOMIGRATE_URL" force 20251217163326Then run
mise clickhouse:migrateas normal.Test plan
mise clickhouse:migratewithCLICKHOUSE_MIGRATION_ENGINE=golang-migrateand verify all migrations apply cleanlymise clickhouse:downrolls back correctly🤖 Generated with Claude Code